<?php
$fb_comp_id=$_GET["fb_comp_id"];
$item_id=$_GET["item_id"];
header("Content-type: application/json");
include("../includes/dbinfo.conf.php");
if(isset($fb_comp_id)){
$sql="SELECT * FROM comparision WHERE fb_comparision_id = '".$fb_comp_id."'";

$result = mysql_query($sql);
$results = array();
while($row = mysql_fetch_array($result))
  {
		$results[] = array(
		'id' => $row['id'],
      'title' => $row['title'],
      'description' => $row['description'],
      'items' => $row['item_ids']
   );
  }
}else if (isset($item_id)) {
	$sql="SELECT * FROM COMPARISION WHERE item_ids like '%,".$item_id.",%' or item_ids like '".$item_id.",%' or item_ids like '%,".$item_id."'";	$result = mysql_query($sql);

	while($row = mysql_fetch_array($result))
	  {
	$results[] = array(
	'id' => $row['id'],
     'title' => $row['title'],
     'description' => $row['description'],
     'items' => $row['item_ids']
  );	  
	}
}
else {
	echo "not set";
}
echo json_encode($results); 
?> 